{% extends "layouts/default.html.twig" %}

{% block title %}{{ 'Volume details'|trans }}{% endblock %}

{% block body %}

    <div class="container-fluid">

        {{ include('partials/_page_header.html.twig', {header: 'Volume details'|trans, description: 'Bacula volume details'|trans }) }}

        <div class="row">
            <div class="col-4">

                <div class="card border-dark mb-3">
                    <div class="card-header">
                        <h3 class="card-title">Details</h3>
                    </div>
                    <div class="card-body">
                        <ul class="list-group">
                            <li class="list-group-item">
                                <b>{{ 'Media id'|trans }}:</b> {{ volume.mediaid }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Volume name'|trans }}:</b> {{ volume.volumename }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Volume bytes'|trans }}:</b> {{ volume.getVolbytes() }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Volume files'|trans }}:</b> {{ volume.volfiles }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Volume jobs'|trans }}:</b> {{ volume.voljobs }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'First written'|trans }}:</b> {{ volume.firstwritten }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Last written'|trans }}:</b> {{ volume.lastwritten }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Mounts'|trans }}:</b> {{ volume.volmounts }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Slot'|trans }}:</b> {{ volume.slot }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'In changer'|trans }}:</b> {{ volume.inchanger|raw }}
                            </li>
                            <li class="list-group-item">
                                <b>{{ 'Media Type'|trans }}:</b> {{ volume.mediatype }}
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="col-8">

                <div class="card border-dark mb-3">
                    <div class="card-header">
                        <h3 class="card-title">{{ 'Jobs'|trans }}</h3>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-condensed table-striped text-center">
                                <caption>Job(s) list for this volume</caption>
                                <thead>
                                <tr>
                                    <th class="text-center">{{ 'Job ID'|trans }}</th>
                                    <th class="text-left">{{ 'Name'|trans }}</th>
                                    <th class="text-center">{{ 'Type'|trans }}</th>
                                </tr>

                                {% for job in jobs %}
                                    <tr>
                                        <td>
                                            <a href="{{ url_for('joblog', {'jobid': job.jobid}) }}"
                                               title="{{ 'Show job'|trans }}">{{ job.jobid }}</a>
                                        </td>
                                        <td>{{ job.name }}</td>
                                        <td>{{ job.type }}</td>
                                    </tr>
                                {% else %}
                                    <tr>
                                        <td colspan="3" class="text-center">
                                            {{ 'No job(s) associated to this volume'|trans }}
                                        </td>
                                    </tr>
                                {% endfor %}
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
